/*!
 * \file Message.h
 * \brief
 */

#ifndef MESSAGE_H
#define MESSAGE_H

#include <cstring>

namespace tsc
{
namespace common
{

#define DELETE_MESSAGE_P(MESS_P)\
{\
  delete MESS_P;\
  MESS_P = 0;\
}

class Message
{
public:
  Message(const void*  aDataP,
          std::size_t  aDataSize,
          unsigned int aConnectionId);
  ~Message();

  const void*  getData();
  std::size_t  getDataSize();
  unsigned int getConnectionId();
  unsigned int getId();

private:
  char*        mDataP;
  std::size_t  mSize;
  unsigned int mConnectionId;

  //! Message instance ID
  unsigned int mInstance;

  //! Message instance counter
  static unsigned int sInstanceCounter;
};

} // namespace common
} // namespace tsc

#endif // MESSAGE_H
